<?php
namespace Shop\Controller;
use Think\Controller;

class ShopController extends Controller{
	/**
     * 后台控制器初始化
     */
    public function __construct(){
		 parent::__construct(); 
        // 获取当前用户ID
        $users = $this->chack_login(); 
        if($users['uid']<1){// 还没登录 跳转到登录页面

           $this->redirect('Public/login');

        }
               $rs = M('shop')->where(array('uid'=>$users['uid']))->find();
			   $arr = M('type')->where(array('type_id'=>$rs['type_id']))->find();
			   $rs['type_name'] = $arr['name'];
			   $rs['shop_cart_image'] = get_cover($arr['shop_cart_image'],'path');
			   $rs['shop_logo_image'] = get_cover($arr['shop_logo_image'],'path');
			   $rs['type_name'] = $arr['name'];
			   $rs['sid'] = $rs['id'];
			   $this->shop_id = $rs['id'];      
			   $this->type_id = $rs['type_id'];  
			   $this->shop_static_info = $rs;
			   session("shop_common_info", $rs);
			   $this->assign('rs',$rs);
			   unset($rs);unset($arr);
			$this->assign('ACTION_NAME',ACTION_NAME);
			$this->assign('CONTROLLER_NAME',CONTROLLER_NAME);

    }

    /** 处理空操作 44**/
    protected function _empty(){
        $this->redirect('Index/index');
    }

    protected function chack_login(){
    	
	    if (!empty(session('shop_auth'))) {
               return session('shop_auth');
	    } else {
		    session('shop_auth', null);
			session("shop_common_info", null);
		     session_destroy();
	        return 0;
	    }
    }


}

?>